<?php
/**
 * authentication element class
 *
 * @final
 * @author raphael seebacher <raphasee@ee.ethz.ch>
 * @version 0.10
 */
final class authentication extends message_element_controller {
    protected $parameters = Array(
      'access_token',
      'access_token_secret',
      'version',
    );

    protected function process_element() {
        $this->check_content_parameters_all_present();

        $user_credentials = new user_credentials();
        $user_credentials->set('access_token', $this->content['access_token']);
        $user_credentials->set('access_token_secret', $this->content['access_token_secret']);
        $user_credentials->set('server_credentials_id', $this->content['version']);

        $uc = user_controller::get_instance();
        $uc->authenticate($user_credentials);

        return Array(
          'status' => 'ok',
        );
    }

    public function get_tag() {
        return 'authentication';
    }
}
?>